import { PureComponent } from 'react';
import moment from 'moment';
import {
    Row,
    Col,
    Form,
    Input,
    Select,
    Modal,
    Cascader,
    DatePicker
} from 'antd';
const FormItem = Form.Item;
const { Option } = Select;
import { dicTextByCodePcode,dicListByPcode } from '@/utils/dictionary'


@Form.create()
class CreateForm extends PureComponent {

	constructor(props) {
	    super(props);
	    this.state = {

	    }
	}


	okHandle = () => {
		const { form,handleAdd } = this.props;

	    form.validateFields((err, fieldsValue) => {
		        if (err) return;
		        form.resetFields();
			   	if(fieldsValue.a0561) {
			   				fieldsValue.a0561 = moment(fieldsValue.a0561._d).format("YYYY-MM-DD");
			   			}
			   	if(fieldsValue.a0557) {
			   				fieldsValue.a0557 = moment(fieldsValue.a0557._d).format("YYYY-MM-DD");
			   			}
			   	if(fieldsValue.a0544) {
			   				fieldsValue.a0544 = moment(fieldsValue.a0544._d).format("YYYY-MM-DD");
			   			}
			    handleAdd(fieldsValue,'PATJobInfo');
		});
	};


	resetButton = () => {

	};

  render() {
    const {form: {getFieldDecorator}, modalVisibleByPATJobInfo,handleModalVisible} = this.props;

return (
    <Modal
width={800}
destroyOnClose
title="添加专业技术职务信息"
visible={modalVisibleByPATJobInfo}
onOk={this.okHandle}
onCancel={() => handleModalVisible(false,"PATJobInfo")}
afterClose={() => this.resetButton()}
>
<Form  layout="vertical">
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		    <Col md={12} sm={24}>
		      <FormItem  label="专业技术职务名称">
		          {getFieldDecorator('a0524', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		          		{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		          			return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		          		}):null}
		          	</Select>
		          )}
		      </FormItem>
		    </Col>

		    <Col md={12} sm={24}>
		      <FormItem  label="任职方式">
		          {getFieldDecorator('a0547', {
		            rules: [{ required: false, message: '请选择'}],
		          })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		            	{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		            		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		            	}):null}
		            </Select>
		          )}
		      </FormItem>
		    </Col>

		</Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		    <Col md={12} sm={24}>
		      <FormItem  label="任职状态">
		          {getFieldDecorator('a0554',{
		          })(
		          	<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		          		{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		          			return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		          		}):null}
		          	</Select>
		          )}
		      </FormItem>
		    </Col>
		    <Col md={12} sm={24}>
		      <FormItem  label="专业技术岗位等级">
		          {getFieldDecorator('a0568', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		                return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              }):null}
		            </Select>
		          )}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		<Col md={12} sm={24}>
		      <FormItem  label="任职变动类别">
		          {getFieldDecorator('a0551', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		          	<Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		          	  	{dicListByPcode('YT') != undefined?dicListByPcode('YT').map((item,index) => {
		          	  		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		          	  	}):null}
		          	  </Select>
		          )}
		      </FormItem>
		    </Col>

		    <Col md={12} sm={24}>
		      <FormItem  label="任职起始日期">
		          {getFieldDecorator('a0544',{
		            rules: [{ required: false, message: '请选择！'}],
		          })(
		            <DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>
		          )}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		    <Col md={12} sm={24}>
		      <FormItem  label="多职务主次序号">
		          {getFieldDecorator('a0527', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <Input placeholder="1-40个字符" />
		          )}
		      </FormItem>
		    </Col>
		    <Col md={12} sm={24}>
		      <FormItem  label="集体内排列顺序">
		          {getFieldDecorator('a0531', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(<Input placeholder="1-40个字符" />)}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		    <Col md={12} sm={24}>
		      <FormItem  label="主管工作">
		          {getFieldDecorator('a0534', {
		          rules: [{ required: false, message: '1-40个字符' }],
		          })(<Input placeholder="1-40个字符" />)}
		      </FormItem>
		    </Col>

		   	<Col  md={12} sm={24}>
		   	  <FormItem  label="批准文件名称或文号">
		   	      {getFieldDecorator('a0545', {
		   	        rules: [{ required: false, message: '1-40个字符'}],
		   	        })(<Input placeholder="1-40个字符" />)}
		   	  </FormItem>
		   	</Col>

		</Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="聘任证书编号">
			      {getFieldDecorator('a0549', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			        <Input placeholder="1-40个字符" />
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="任职预定截止日期">
		        {getFieldDecorator('a0557', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>
		          )}
		    </FormItem>
		  </Col>
		</Row>

		{/* 任职机构信息*/}
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="名称">
			      {getFieldDecorator('a0501_1', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			        <Input placeholder="1-40个字符" />
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="代码">
		        {getFieldDecorator('a0501_2', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(
		          <Input placeholder="1-40个字符" />
		        )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="所在政区">
			      {getFieldDecorator('a0504', {
			        rules: [{ required: false, message: '请选择'}],
			        })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		                return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              }):null}
		            </Select>
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="隶属关系">
		        {getFieldDecorator('a0507', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		                return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              }):null}
		            </Select>
		          )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="级别">
			      {getFieldDecorator('a0511', {
			        rules: [{ required: false, message: '请选择'}],
			        })(
			        <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
			          {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
			            return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
			          }):null}
			        </Select>
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="性质类别">
		        {getFieldDecorator('a0514', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		              {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		                return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		              }):null}
		            </Select>
		          )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="所属行业">
			      {getFieldDecorator('a0517', {
			        rules: [{ required: false, message: '请选择'}],
			        })(
			        <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
			          {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
			            return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
			          }):null}
			        </Select>
			      )}
			  </FormItem>
			</Col>
		  {/* 免职信息*/}
		  <Col md={12} sm={24}>
		    <FormItem  label="免职日期">
		        {getFieldDecorator('a0561', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>
		          )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="免职变动类别">
			      {getFieldDecorator('a0567', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			        <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
			          {dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
			            return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
			          }):null}
			        </Select>
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="多职务名称描述">
		        {getFieldDecorator('a0565', {
		          rules: [{ required: false, message: '请选择'}],
		          })(
		            <Input placeholder="1-40个字符" />
		          )}
		    </FormItem>
		  </Col>
		</Row>

</Form>
</Modal>
);
  }

}

export default CreateForm;
